<template>
  <div class="container-layer-mydynamic">
    <div v-for="(temp,index) in list" :key="index" class="container-layer">
      <ItemDynamic :dynamic-data="temp" />
    </div>
  </div>
</template>

<script>
// api
import { getDynamicList } from '@/api/dynamic'
// item
import ItemDynamic from '@/components/ItemDynamic'
// vuex
import { mapGetters } from 'vuex'
export default {
  components: {
    ItemDynamic: ItemDynamic
  },
  data() {
    return {
      list: []
    }
  },
  computed: {
    ...mapGetters([
      'userInfo'
    ])
  },
  async created() {
    const { id = null } = this.$route.params
    if (!id) {
      return this.$router.replace('/')
    }
    const res = await getDynamicList({ id })
    console.log(res)
    this.list = res.data
  }
}
</script>
